<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //promise自身上的方法
        let obj = {
            name:"tom",
        }
        let p1 = Promise.resolve(obj);
        console.log(p1);
        p1.then((data)=>{
            console.log(data);
        })
        let p2 = Promise.reject({content:"失败"});
        p2.catch((err)=>{
            console.log(err);
        })
        let p3 = Promise.all([p1,p2]);
        console.log(p3);
        p3.then((data)=>{
            console.log(data);
        })
        p3.catch((err)=>{
            console.log(err);
        })
        let p4 = Promise.race([p1,p2]);
        p4.then((data)=>{
            console.log(data);
        })
    </script>
</body>
</html>